﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace PowerPatcher
{
    public partial class ErrorReport : Form
    {
        private Exception ex;
        private List<string> errorMessages = new List<string>()
        {
            PowerPatcher.Msgs.WhileCopyingDownloadFilesAProblemOccurs,
            PowerPatcher.Msgs.EnchantWasAHUGEFailure,
            PowerPatcher.Msgs.IMSorryMyHandMustVeSlipped,
            PowerPatcher.Msgs.ThePerformanceWasATotalMess
        };
        public ErrorReport(Exception _ex)
        {
            ex = _ex;
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void ErrorReport_Load(object sender, EventArgs e)
        {
            Random r = new Random();
            label1.Text = errorMessages[r.Next(errorMessages.Count)];
            textBox1.Text = string.Format(@"Date: {0}
OS: {1}
Application Directory: {2}
Current Directory {3}
System Folder: {4}
.NET Runtime: {5}

Exception detail: {6}", DateTime.Now.ToString(), Environment.OSVersion, Application.StartupPath, Environment.CurrentDirectory, Environment.SystemDirectory,
                      System.Runtime.InteropServices.RuntimeEnvironment.GetSystemVersion(), ex.ToString());
        }

        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            System.Diagnostics.Process.Start("http://powerpatcher.codeplex.com/workitem/list/basic");
        }
    }
}
